package com.cherry.androidviewdemo.activity

import android.graphics.Color
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.cherry.androidviewdemo.R
import com.cherry.androidviewdemo.widget.CustomLayoutManager
import kotlinx.android.synthetic.main.activity_recycler_view.*

/**
 * @author DongMS
 * @since 2020/5/27
 */
class RecyclerViewActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_recycler_view)
        recycler_view.layoutManager = CustomLayoutManager()
        recycler_view.adapter = object : BaseQuickAdapter<String, BaseViewHolder>(android.R.layout.simple_list_item_1, (1..100).map { "item${it}" }) {
            override fun convert(helper: BaseViewHolder, item: String) {
                helper.itemView.setBackgroundColor(Color.YELLOW)
                helper.setText(android.R.id.text1, item)
            }

        }

    }

}